/**
 */
package proyecto.testcasetool.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

import proyecto.testcasetool.EnumerationRange;
import proyecto.testcasetool.TestcasetoolPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Enumeration Range</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link proyecto.testcasetool.impl.EnumerationRangeImpl#getBaseEnum <em>Base Enum</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.EnumerationRangeImpl#getEnumValue <em>Enum Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EnumerationRangeImpl extends ParameterRangeImpl implements EnumerationRange {
	/**
	 * The cached value of the '{@link #getBaseEnum() <em>Base Enum</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBaseEnum()
	 * @generated
	 * @ordered
	 */
	protected EList<String> baseEnum;

	/**
	 * The default value of the '{@link #getEnumValue() <em>Enum Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnumValue()
	 * @generated
	 * @ordered
	 */
	protected static final String ENUM_VALUE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getEnumValue() <em>Enum Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnumValue()
	 * @generated
	 * @ordered
	 */
	protected String enumValue = ENUM_VALUE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EnumerationRangeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TestcasetoolPackage.Literals.ENUMERATION_RANGE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getBaseEnum() {
		if (baseEnum == null) {
			baseEnum = new EDataTypeUniqueEList<String>(String.class, this, TestcasetoolPackage.ENUMERATION_RANGE__BASE_ENUM);
		}
		return baseEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getEnumValue() {
		return enumValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnumValue(String newEnumValue) {
		String oldEnumValue = enumValue;
		enumValue = newEnumValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.ENUMERATION_RANGE__ENUM_VALUE, oldEnumValue, enumValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TestcasetoolPackage.ENUMERATION_RANGE__BASE_ENUM:
				return getBaseEnum();
			case TestcasetoolPackage.ENUMERATION_RANGE__ENUM_VALUE:
				return getEnumValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TestcasetoolPackage.ENUMERATION_RANGE__BASE_ENUM:
				getBaseEnum().clear();
				getBaseEnum().addAll((Collection<? extends String>)newValue);
				return;
			case TestcasetoolPackage.ENUMERATION_RANGE__ENUM_VALUE:
				setEnumValue((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.ENUMERATION_RANGE__BASE_ENUM:
				getBaseEnum().clear();
				return;
			case TestcasetoolPackage.ENUMERATION_RANGE__ENUM_VALUE:
				setEnumValue(ENUM_VALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.ENUMERATION_RANGE__BASE_ENUM:
				return baseEnum != null && !baseEnum.isEmpty();
			case TestcasetoolPackage.ENUMERATION_RANGE__ENUM_VALUE:
				return ENUM_VALUE_EDEFAULT == null ? enumValue != null : !ENUM_VALUE_EDEFAULT.equals(enumValue);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (baseEnum: ");
		result.append(baseEnum);
		result.append(", enumValue: ");
		result.append(enumValue);
		result.append(')');
		return result.toString();
	}

} //EnumerationRangeImpl
